package com.niocholas.study.designpatterns.chainofresponsibility.normal;

public abstract class NormalHandler {

    //tips Successor:接班人
    protected NormalHandler successor = null;

    public void setSuccessor(NormalHandler successor) {
        this.successor = successor;
    }

    public final void handle() {
        boolean handled = doHandle();
        if (successor != null && !handled) {
            successor.handle();
        }
    }

    protected abstract boolean doHandle();

}